startActivityForResult

open fun startActivityForResult(@NonNull intent: Intent, requestCode: Int)(source)

Deprecated

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use registerForActivityResult passing in a StartActivityForResult object for the ActivityResultContract.

Call startActivityForResult from the fragment's containing Activity.

Parameters

intent

The intent to start.

requestCode

The request code to be returned in onActivityResult when the activity exits. Must be between 0 and 65535 to be considered valid. If given requestCode is greater than 65535, an IllegalArgumentException would be thrown.


open fun startActivityForResult(@NonNull intent: Intent, requestCode: Int, @Nullable options: Bundle)(source)

Deprecated

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use registerForActivityResult passing in a StartActivityForResult object for the ActivityResultContract.

Call startActivityForResult from the fragment's containing Activity.

Parameters

intent

The intent to start.

requestCode

The request code to be returned in onActivityResult when the activity exits. Must be between 0 and 65535 to be considered valid. If given requestCode is greater than 65535, an IllegalArgumentException would be thrown.

options

Additional options for how the Activity should be started. See startActivity for more details. This value may be null.